/*
 * Author: 凌逆战 | Never
 * Data: 2023/10/10
 * Description: 
 */

void convert_i16_to_f32(short* p_in, int len, float* p_out) {
    for (int i = 0; i < len; i++) {
        *p_out++ = *p_in++ / 32768.0f;
    }
}

void convert_f32_to_i16(float* p_in, int len, short* p_out) {
    for (int i = 0; i < len; i++) {
        float tmp = *p_in++ * 32768.0f;
        *p_out++ = (short)(tmp < -32768.f ? -32768.f : (tmp > 32767.f ? 32767.f : tmp));
    }
}